import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const state = {
    amount: 5, // 购物车商品数量
    choseAmount: 6 // 购物车选中的商品数量
}
const getters = {
    getAmount(state) {
        return state.amount
    },
    getChoseAmount(state) {
        return state.choseAmount
    }
}
const mutations = {
    addAmount(state, payload) {
        state.amount+= payload
    },
    AddChoseAmount(state) {
        return state.choseAmount
    }
}
const actions = {
}

export default {
    namespaced: true, // 开启命名空间
    state,
    getters,
    mutations,
    actions
}
